Re: isset or ! isset what is my problem?
Re: isset or ! isset what is my problem?
am 03.01.2006 04:50:13 von John in Pueblo
On Monday 02 January 2006 8:54 pm, Ralph wrote:
> I'm building a URL based on data extracted from mySQL and I want the
> text space.gif used as my default value should the variable $picture
> by NULL.
>
> The results of the code below kick back a value for $picture when it
> is set in the database, but ignores the space.gif if the database
> result is empty.
Have you tried strlen()?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
isset or ! isset what is my problem?
am 03.01.2006 04:54:45 von ralph
--Apple-Mail-6--960504288
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed
I'm building a URL based on data extracted from mySQL and I want the
text space.gif used as my default value should the variable $picture
by NULL.
The results of the code below kick back a value for $picture when it
is set in the database, but ignores the space.gif if the database
result is empty.
If I flip the test from ! isset to isset then I get the space.gif for
each result.
I've had no luck searching out an answer.
Thanks in advance.
--------------The Code-----------------------------
span>
span>
Showtime:
['ShowTime']; ?>
Location:
['Location']; ?>
($rst_screenings)); ?>
---------------END-----------------
--Apple-Mail-6--960504288--
Re: isset or ! isset what is my problem?
am 03.01.2006 04:59:03 von Micah Stevens
NULL != Not set.
isset() tests to see if the variable exists. If your variable has a null value
it is set, it DOES exist, it just has NULL for a value. You should test for a
null value if that's what you want:
if ($picture == null)
Or perhaps the empty() function might be what you're looking for.
-Micah
On Monday 02 January 2006 7:54 pm, Ralph wrote:
> I'm building a URL based on data extracted from mySQL and I want the
> text space.gif used as my default value should the variable $picture
> by NULL.
>
> The results of the code below kick back a value for $picture when it
> is set in the database, but ignores the space.gif if the database
> result is empty.
>
> If I flip the test from ! isset to isset then I get the space.gif for
> each result.
>
>
> I've had no luck searching out an answer.
>
> Thanks in advance.
>
> --------------The Code-----------------------------
>
>
>
> span>
>
> span>
>
> Showtime:
> ['ShowTime']; ?>
> Location:
> ['Location']; ?>
>
>
> ($rst_screenings)); ?>
>
> ---------------END-----------------
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: isset or ! isset what is my problem?
am 03.01.2006 12:24:17 von El Bekko
> On Monday 02 January 2006 7:54 pm, Ralph wrote:
>
>>I'm building a URL based on data extracted from mySQL and I want the
>>text space.gif used as my default value should the variable $picture
>>by NULL.
>>
>>The results of the code below kick back a value for $picture when it
>>is set in the database, but ignores the space.gif if the database
>>result is empty.
>>
>>If I flip the test from ! isset to isset then I get the space.gif for
>>each result.
>>
>>
>>I've had no luck searching out an answer.
>>
>>Thanks in advance.
>>
>>--------------The Code-----------------------------
>>
>>
>>
>>span>
>>
>>span>
>>
>>Showtime:
>>['ShowTime']; ?>
>>Location:
>>['Location']; ?>
>>
>>
>>($rst_screenings)); ?>
>>
>>---------------END-----------------
Seeing as you're querying, use mysql_num_rows() to check.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: isset or ! isset what is my problem?
am 03.01.2006 16:27:14 von ralph
Actually this has nothing to do with rows. I'm just trying to
substitute a value when a query returns an empty value.
On Jan 3, 2006, at 5:24 AM, El Bekko wrote:
>> On Monday 02 January 2006 7:54 pm, Ralph wrote:
>>> I'm building a URL based on data extracted from mySQL and I want the
>>> text space.gif used as my default value should the variable $picture
>>> by NULL.
>>>
>>> The results of the code below kick back a value for $picture when it
>>> is set in the database, but ignores the space.gif if the database
>>> result is empty.
>>>
>>> If I flip the test from ! isset to isset then I get the space.gif
>>> for
>>> each result.
>>>
>>>
>>> I've had no luck searching out an answer.
>>>
>>> Thanks in advance.
>>>
>>> --------------The Code-----------------------------
>>>
>>>
>>>
>>> >
>>> span>
>>>
>>> >
>>> span>
>>>
>>> Showtime:
>>> ['ShowTime']; ?>
>>> Location:
>>> ['Location']; ?>
>>>
>>>
>>> ($rst_screenings)); ?>
>>>
>>> ---------------END-----------------
>
> Seeing as you're querying, use mysql_num_rows() to check.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php